package com.pi.bed;

import java.text.ParseException;
import java.util.List;

import com.alibaba.fastjson.JSON;
import com.pi.comm.sequence.SnowflakeFactory;
import com.pi.uc.dao.entity.UcUserEntity;
import com.pi.uc.dao.entity.UserLoginLogEntity;
import com.pi.uc.util.TokenUtil;

public class SnowflakeId{
  public static void main(String[] args) throws Exception {
    System.out.println(SnowflakeFactory.getDefaultWorker().nextId());
    UcUserEntity entity = new UcUserEntity();
    entity.setId(36521568171458560L);
    entity.setSourceId(2540069822922752L);
    System.out.println(TokenUtil.getUserToken(entity));
    System.out.println(Double.valueOf("0.0分".replaceAll("[^\\d\\.]", "")).intValue());
    String s = "[\"8b0d8d9c-1431-4fa6-9f68-de2a49690aa8\",\"8b0d8d9c-1431-4fa6-9f68-de2a49690aa8\"]";
    List<String> msgIds = JSON.parseArray(s, String.class);
    String[] ids = new String[] {"8b0d8d9c-1431-4fa6-9f68-de2a49690aa8"};
    VOClas vls = new VOClas();
    vls.setDeviceId("6B35068F-6C21-4C40-90A9-EEA7709F4EAF");
    vls.setMsgIds(ids);
    System.out.println(JSON.toJSONString(ids));
    System.out.println(JSON.toJSONString(vls));
  String data = "{\"msgIds\":[\"8b0d8d9c-1431-4fa6-9f68-de2a49690aa8\"],\"deviceId\":\"6B35068F-6C21-4C40-90A9-EEA7709F4EAF\"}";
  VOClas vo = com.alibaba.fastjson.JSON.parseObject(data, VOClas.class);
  System.out.println(vo.getDeviceId());
  }
  static class VOClas{
    private String[] msgIds;
    private String deviceId;
    public String[] getMsgIds() {
      return msgIds;
    }
    public void setMsgIds(String[] msgIds) {
      this.msgIds = msgIds;
    }
    public String getDeviceId() {
      return deviceId;
    }
    public void setDeviceId(String deviceId) {
      this.deviceId = deviceId;
    }
  }
}
